Crate biome_deserialize
source ·Expand description
biome_deserialize
consists of data structures that know how to deserialize themselves
along with data formats that know how to deserialize data.
It provides a framework by which these two groups interact with each other,
allowing any supported data structure to be deserialized using any supported data format.
This crate inspired by serde.
0ne of the main difference is the fault-tolerant behavior of biome_deserialize
.
Serde uses a fast-fail strategy, while biome_deserialize
deserialize as much as possible
and report several diagnostics (errors, warning, deprecation messages, …).
Also, biome_deserialize
is intended to deserialize textual data formats.
biome_deserialize
assumes that every supported data formats supports the following types:
- null-like values;
- boolean;
- number – integers and floats;
- string;
- array;
- maps of key-value pairs (covers objects).
It currently supports the JSON data format. See [biome_deserialize::json] for more details.
The two most important traits are Deserializable and DeserializableValue.
- A type that implements
Deserializable
is a data structure that can be deserialized from any supported data format; - A type that implements
DeserializableValue
is a data format that can deserialize any supported data structure.
You can find a guide and more examples in the README.
Re-exports§
pub use string_set::StringSet;
Modules§
- Implementation of DeserializableValue for the JSON data format.
Structs§
- Diagnostic emitted during the deserialization
- A small type to interrogate the result of a JSON deserialization
- Type that allows deserializing a string without heap-allocation.
- A string representation of an integer or a float. The format should be parsable by Rust numeric types.
- A range in text, represented as a pair of
TextSize
.
Traits§
- Implemented by data structures that can deserialize any DeserializableValue.
- Trait that should be implemented on types that use the
#[deserializable(with_validator)]
annotation with the biome_deserialize_macros::Deserializable derive macro. - Implemented by data structure that can be deserialized.
- This trait represents a visitor that walks through a DeserializableValue.
- Trait that allows deep merging of types, including injection of defaults.
Functions§
- Validates whether the given value is non-empty.